#include <cstdio>
#include <ctime>
#include <cstdlib>

using namespace std;

const int maxn=5, maxm=3;

int myr(int l, int r) {
    return rand()%(r-l+1)+l;
}

void makeData() {
    int n=maxn, m=maxm;
    FILE *f=fopen("catalan.in", "w");
    fprintf(f, "%d %d\n", n, m);
    for (int i=1; i<=m; i++) {
        int t=myr(2, n);
        fprintf(f, "%d %d\n", t, myr(1, t-1));
    }
    fclose(f);
}

int main() {
    srand(time(0));
    for (int i=1;; i++) {
        makeData();
        if (system("./bin")) {
            printf("RE!\n");
            return -1;
        } else if(system("./check")) {
            printf("CE!\n");
            return -1;
        } else if (system("cmp check.out catalan.out")) {
            printf("WA!\n");
            return -1;
        }
        printf("%d:AC!\n", i);
    }
    return 0;
}
